package cn.readjava.bean;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;

@Entity
public class Website implements Serializable {
    private long websiteId;
    private String websiteTitle;
    private String websiteIcon;
    private String websiteContent;

    @Id
    @Column(name = "website_id", nullable = false)
    public long getWebsiteId() {
        return websiteId;
    }

    public void setWebsiteId(long websiteId) {
        this.websiteId = websiteId;
    }

    @Basic
    @Column(name = "website_title", nullable = true, length = 255)
    public String getWebsiteTitle() {
        return websiteTitle;
    }

    public void setWebsiteTitle(String websiteTitle) {
        this.websiteTitle = websiteTitle;
    }

    @Basic
    @Column(name = "website_icon", nullable = true, length = 255)
    public String getWebsiteIcon() {
        return websiteIcon;
    }

    public void setWebsiteIcon(String websiteIcon) {
        this.websiteIcon = websiteIcon;
    }

    @Basic
    @Column(name = "website_content", nullable = true, length = -1)
    public String getWebsiteContent() {
        return websiteContent;
    }

    public void setWebsiteContent(String websiteContent) {
        this.websiteContent = websiteContent;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Website website = (Website) o;
        return websiteId == website.websiteId &&
                Objects.equals(websiteTitle, website.websiteTitle) &&
                Objects.equals(websiteIcon, website.websiteIcon) &&
                Objects.equals(websiteContent, website.websiteContent);
    }

    @Override
    public int hashCode() {

        return Objects.hash(websiteId, websiteTitle, websiteIcon, websiteContent);
    }
}
